import Vue from 'vue';
import iView from 'iview';
import VueRouter from 'vue-router';
import Routers from './router';

import Util from './libs/util';
import App from './app.vue';
import 'iview/dist/styles/iview.css';
import './assets/css/swiper.min.css';
import 'velocity-animate/velocity';
import 'velocity-animate/velocity.ui';
import VueVideoPlayer from 'vue-video-player';
Vue.use(VueRouter).use(VueVideoPlayer);

import VueLazyload from 'vue-lazyload' //引入这个懒加载插件

Vue.use(VueLazyload)

import BaiduMap from 'vue-baidu-map'
Vue.use(BaiduMap, {
    // ak 是在百度地图开发者平台申请的密钥 详见 http://lbsyun.baidu.com/apiconsole/key */
    ak: 'Bbc6AX5b3IltIb2DzEEUw2IN4XYrvKhx'
})
Vue.use(iView);
// banner
import Banner from './components/Banner'
Vue.component('Banner', Banner)
// banner
import BannerImg from './components/BannerImg'
Vue.component('BannerImg', BannerImg)
// LeftSider
import LeftSider from './components/LeftSider'
Vue.component('LeftSider', LeftSider)


import axios from './libs/axios'
window.axios = axios

// 路由配置
const RouterConfig = {
    mode: 'history',
    routes: Routers
};
const router = new VueRouter(RouterConfig);

router.beforeEach((to, from, next) => {
    iView.LoadingBar.start();
    Util.title(to.meta.title);
    next();
});

router.afterEach(() => {
    iView.LoadingBar.finish();
    window.scrollTo(0, 0);
});



new Vue({
    el: '#app',
    router: router,
    render: h => h(App)
});